package com.example.lib_base.net

import com.example.lib_base.entity.*
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Path
import retrofit2.http.Query

interface ApiService {
    //登录
    @POST("/api/user/login")
    suspend fun login(@Query("username") username:String,@Query("password") password:String):Res<UserBean>
    //注册
    @POST("/api/user/register")
    suspend fun register(@Query("username") username:String,@Query("password") password:String):Res<UserBean>
    //公告
    @GET("/api/announcements")
    suspend fun getNotice(@Query("page") page:Int,@Query("size") size:Int):Res<NoticeBean>
    //新闻列表
    @GET("/api/news")
    suspend fun getNews():Res<NewsBean>
    //消息列表
    @GET("/api/messages")
    suspend fun getMessage(@Query("accessId") accessId:String,@Query("userId")userId:Int):Res<MessageBean>
    //车位列表
    @GET("/api/parking-spaces/type/{spaceType}")
    suspend fun getPark(@Path("spaceType")spaceType:String):Res<ParkBean>
    //
    @GET("/api/parking-spaces/status/{spaceStatus}")
    suspend fun getParkByStatus(@Path("spaceStatus") spaceStatus:String):Res<ParkBean>
    //指定区域
    @GET("/api/parking-spaces/area/{areaId}")
    suspend fun getParkByArea(@Path("areaId")areaId:Int):Res<ParkBean>
    //车牌号
    @GET("/api/parking-spaces/license/{licensePlate}")
    suspend fun getParkCarNum(@Path("licensePlate")licensePlate:String):Res<ParkBean>
    //维修列表
    @GET("/api/repair-orders")
    suspend fun getWeiXiu():Res<WeiXiuEntity>
    //添加车位
    @POST("/api/parking-spaces")
    suspend fun getAddPark(@Body body: RequestBody):Res<ParkBeanItem>
    //访客
    @GET("/api/visit-appointments")
    suspend fun getFang():Res<FangKeBean>
    //内容访客搜索
    @GET("/api/visit-appointments/search/purpose")
    suspend fun getSou(@Query("purpose") purpose:String):Res<FangKeBean>
    //修改车位
    @PUT("/api/parking-spaces/{id}")
    suspend fun upDate(@Path("id") id:Int,@Body body: RequestBody):Res<ParkBeanItem>
    //删除车位
    @DELETE("/api/parking-spaces/{id}")
    suspend fun deletePark(@Path("id") id:Int):Res<Boolean>
    @GET("/api/parking-spaces/{id}")
    suspend fun getParkById(@Path("id")id:Int):Res<ParkBeanItem>
    //根据工单号查询
    @GET("/api/repair-orders/order-number/{orderNumber}")
    suspend fun getWeiXiuQuery(@Path("orderNumber")orderNumber:String):Res<WeiXiuEntityItem>
    //根据报修人查询
    @GET("/api/repair-orders/search")
    suspend fun getWeiXiuQueryRen(@Query("repairName")repairName:String):Res<WeiXiuEntity>
    //维修详情
    @GET("/api/repair-orders/{id}")
    suspend fun getWeiXiuXq(@Path("id") id:Int):Res<WeiXiuEntityItem>
    //新建维修
    @POST("/api/repair-orders")
    suspend fun addWeiXiu(@Body body: WeiXiuEntityItem):Res<WeiXiuEntityItem>
    //删除维修
    @DELETE("/api/repair-orders/{id}")
    suspend fun delWeiXiu(@Path("id") id:Int):Res<WeiXiuEntity>
}